package cn.shoukaiseki.sjf4j.fastjson;

import cn.shoukaiseki.sjf4j.node.JsonNodeType;
import cn.shoukaiseki.sjf4j.node.NumberType;

public class FastjsonBooleanNode extends FastjsonValueNode<Boolean>{

    public FastjsonBooleanNode(Boolean value) {
        super(value);
    }

    @Override
    public JsonNodeType getNodeType() {
        return JsonNodeType.BOOLEAN;
    }


    @Override
    public int asInt() {
        return value ? 1 : 0;
    }

    @Override
    public Integer asIntVal() {
        return value ? 1 : 0;
    }

    @Override
    public Long asLongVal() {
        return value ? 1L : 0L;
    }

    @Override
    public long asLong() {
        return value ? 1L : 0L;
    }

    @Override
    public Double asDoubleVal() {
        return value ? 1.0 : 0.0;
    }

    @Override
    public double asDouble() {
        return value ? 1.0 : 0.0;
    }

    @Override
    public boolean asBoolean() {
        return value.booleanValue();
    }
}
